package tag33_26_08.queue;

import java.util.PriorityQueue;

public class Que01_UsePriorityQueue {

	public static void main(String[] args) {

		PriorityQueue<String> pQueue = new PriorityQueue<String>();
		
		pQueue.add("Mo");
		pQueue.add("Mo");
		
		pQueue.offer("Di");
		pQueue.offer("Di");
		
		pQueue.add("x");
		pQueue.add("X");
		
		System.out.println(pQueue);
		
		String next = pQueue.peek(); //nicht entfernt
		System.out.println("next: " + next);
		
		System.out.println(pQueue);
		
		next = pQueue.poll(); //entfernt 
		System.out.println("next: " + next);
		System.out.println(pQueue);
		
//		pQueue.remove();
		
		System.out.println("-------------------------");
		
		while( !pQueue.isEmpty() ) {
			System.out.print( pQueue.poll() +" ");
		}
		
		System.out.println("------------------------");
		System.out.println( pQueue.poll() );
//		System.out.println( pQueue.remove() ); //Exception

	}// end of main

}
